home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Presentations / Presentations ’97 / Sessions ’97 / Multiplatform Code⁄Data Sharing / HelloBothWorlds / Libraries / common.h < prev    next >
Encoding:
Text File  |  1997-06-26  |  1.4 KB  |  67 lines  |  [TEXT/CWIE]

  1.  
  2. // mail <chelly@eden.com> or surf http://www.eden.com/~chelly for feedback
  3. // free source code - do whatever you like with it
  4.  
  5. // common stuff that must be included in source files (especially on windows)
  6.  
  7. #ifndef common_H
  8. #define common_H
  9.  
  10. // Find operating system we're compiling for
  11.  
  12. // Macintosh
  13. #if defined __MWERKS__
  14.     #define TARGET_IS_MACOS 1
  15.  
  16. // Windows
  17. #elif defined _MSC_VER
  18.     #define TARGET_IS_WIN95 1
  19.  
  20. // One we don't know of
  21. #else
  22.     #error Unknown operating system
  23.  
  24. #endif
  25.  
  26. // nil - gotta feel at home
  27. #include <stddef.h>
  28. #ifndef nil
  29.     #define nil NULL
  30. #endif
  31.  
  32. // definite-sized types, in bits
  33. typedef signed char          int8;
  34. typedef unsigned char     uint8;
  35. typedef signed short     int16;
  36. typedef unsigned short    uint16;
  37. typedef signed long         int32;
  38. typedef unsigned long    uint32;
  39.  
  40. // assertions make safer programming
  41. #include <assert.h>
  42.  
  43. // neato cool assertion that can be at the top level of a source file,
  44. // inside a class, or in a function... WOW!!!
  45. // no overhead because it's evaluated and checked at compile time instead
  46. // of run time
  47. // because of this, condition must be a constant expression
  48. #define assert_anywhere( expr ) struct { int array [(expr) ? 1 : -1]; }
  49.  
  50. #if TARGET_IS_WIN95
  51.  
  52. #include <afxwin.h>            // MFC core and standard components
  53. #include <afxext.h>         // MFC extensions (including VB)
  54. #include <mmsystem.h>
  55.  
  56. enum
  57. {
  58.     UM_SPENDTIME = WM_USER
  59. };
  60.  
  61. #endif
  62.  
  63. #include "preload.h"
  64.  
  65. #endif
  66.  
  67.